<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <script th:src="@{/js/vue.js}" type="text/javascript"></script>
    <script th:src="@{/js/axios.js}" type="text/javascript"></script>
    <link th:href="@{/js/el/element.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/js/el/element.js}" type="text/javascript"></script>
    <title>阅读全文</title>
</head>
<body>
<div id="app">
    <div th:include="~{menu/head::head}"></div>
<hr>
<p>
标题：{{concent.blog.title}}&nbsp;&nbsp;&nbsp;<div th:style="${session.SPRING_SECURITY_CONTEXT!=null}?'padding:0px 0px 0px 0px;':'display:none;'"><el-button @click="addlike(concent.blog.id)" type="warning" icon="el-icon-star-off" circle>{{concent.blog.likenum}}</el-button></div>
</p>
<hr>
    <p v-html="concent.boke.body"></p>
    <hr>
<p>
    发布时间:{{concent.blog.tpress}}&nbsp;
    作者:{{concent.blog.author}}&nbsp;
    阅读:{{concent.blog.pageviews}}&nbsp;
</p>
</div>
</body>
<script>
    new Vue({
        el: '#app',
        data: {
            concent:{
                boke:{},
                blog:{}
            },
            activeIndex: '1'
        },
        methods: {
            handleSelect(key, keyPath) {
                console.log(key, keyPath);
            },
            addlike(id){
                console.log(id);
                var that = this
                axios.get("/client/addLike/"+id).then(function (resp) {
                    that.$message({
                        message: resp.data.msg,
                        type: 'success'
                    });
                    axios.get("/public/read/"+that.concent.blog.id).then(function (resp) {
                        console.log(resp.data)
                        that.concent = resp.data.data
                    })
                })
            }
        },
        mounted: function () {
            var that = this
            var blogId = sessionStorage.getItem("blogId");
            axios.get("/public/read/"+blogId).then(function (resp) {
                console.log(resp.data)
                that.concent = resp.data.data
            })
        }
    })
</script>
</html>